<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>

    <transition>
      <h2 class="title1" v-show="isShow">你好1</h2>
    </transition>

    <transition>
      <h2 class="title2" v-show="isShow">你好2</h2>
    </transition>
  </div>
</template>

<script>
  export default {
    name:'App',
    data() {
      return {
        isShow:true
      }
    },
  }
</script>

<style>
  * {
    margin: 0;
    padding: 0;
  }
  h2 {
    background-image: linear-gradient(45deg,red,yellow,pink,green);
    box-shadow: 0 0 5px;
  }
  .title1 {
    transition: 3s linear;
  }
  .title2 {
    transition: 1s linear;
  }
  /* 离开的起点,回来的终点*/
  .v-leave,.v-enter-to {
    transform: translateX(0);
  }
  /* 离开的终点,回来的起点 */
  .v-leave-to,.v-enter {
    transform: translateX(-100%);
  }
</style>